home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 6_15.lha / 6_15 / 6_15h.h next >
Text File  |  1993-08-08  |  2KB  |  56 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. *
  6. vector of four floats
  7. Exercise 6.15
  8. /
  9. ifndef VEC4_H
  10. define VEC4_H
  11.  
  12.  include <stream.h>
  13.  
  14. verload gauss;        // DELETE
  15. include "6_15h1.h"    // EXPAND class, vec4(), ~vec4()
  16.  
  17.             // vec4 x(0.,0.,0.,0.);
  18.    vec4(float a, float b, float c, float d);
  19.  
  20.    vec4(vec4& a);        // vec4 x = y;
  21.    vec4(float a);        // vec4 x = 35.;
  22.    vec4(int a);        // vec4 x = 35;
  23.  
  24.    vec4 operator=(vec4 a);    // x = y;
  25.    vec4 operator=(float a);    // x = 35.;
  26.  
  27.    // x = a + b, a - b, a * b, a / b, +a, -a
  28.    friend vec4 operator+(vec4 a, vec4 b);
  29.    friend vec4 operator-(vec4 a, vec4 b);
  30.    friend vec4 operator*(vec4 a, vec4 b);
  31.    friend vec4 operator/(vec4 a, vec4 b);
  32.    friend vec4 operator+(vec4 a);
  33.    friend vec4 operator-(vec4 a);
  34.  
  35.    vec4 operator+=(vec4 a);    // x += a
  36.    vec4 operator-=(vec4 a);    // x -= a
  37.    vec4 operator*=(vec4 a);    // x *= a
  38.    vec4 operator/=(vec4 a);    // x /= a
  39.  
  40.    float& operator[](int i);    // f = a[i]
  41.  
  42.    // x = a == b, a != b
  43.    friend int operator==(vec4 a, vec4 b);
  44.    friend int operator!=(vec4 a, vec4 b);
  45.  
  46.             // cout << a
  47.    friend ostream& operator<< (ostream& out, vec4 a);
  48.    float dot(vec4 a);            // x = a.dot(b)
  49.    friend class mat4;            // DELETE
  50.    friend vec4 operator*(mat4, vec4);    // DELETE
  51.    friend vec4 operator*(vec4, mat4);    // DELETE
  52.    friend int gauss(mat4& a, mat4& b);    // DELETE
  53.    friend int gauss(mat4& a, vec4& b);    // DELETE
  54. ;
  55. endif /* VEC4_H */
  56.